<?php
/**
 * @version 0.8.3 2010-10-07
 * @package Joomla
 * @subpackage LeagueResults
 * @copyright (C)  2008, 2009, 2010 Henryk Drozd
 * @license GNU/GPL, see LICENSE.php
 * LeagueResults is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License 2
 * as published by the Free Software Foundation.

 * LeagueResults is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

defined('_JEXEC') or die('Restricted access');
?>

<form action="index.php" method="post" name="adminForm">

<table class="adminform">
	<tr>
		<td width="100%">
			 <?php echo JText::_( 'SEARCH' ).' '.$this->lists['filter']; ?>
			<input type="text" name="search" id="search" value="<?php echo $this->lists['search']; ?>" class="text_area" onChange="document.adminForm.submit();" />
			<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
			<button onclick="this.form.getElementById('search').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
		</td>
		<td nowrap="nowrap"><?php echo $this->lists['table']; ?></td>
		<td nowrap="nowrap"><?php echo $this->lists['season']; ?></td>
		<td nowrap="nowrap"><?php echo $this->lists['state']; ?></td>
	</tr>
</table>

<table class="adminlist" cellspacing="1">
	<thead>
		<tr>
			<th width="5"><?php echo JText::_( 'Num' ); ?></th>
			<th width="5"><input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count( $this->rows ); ?>);" /></th>
			<th width="30%"><?php echo JHTML::_('grid.sort', 'LEAGUESEASONS_ID', 'th.leagueseasons_id', $this->lists['order_Dir'], $this->lists['order'] ); ?></th>
			<th width="30%"><?php echo JHTML::_('grid.sort', 'SEASON', 's.name', $this->lists['order_Dir'], $this->lists['order'] ); ?></th>
			<th width="5%"><?php echo JHTML::_('grid.sort', 'TNAME', 'th.name', $this->lists['order_Dir'], $this->lists['order'] ); ?></th>
			<th width="30%"><?php echo JHTML::_('grid.sort', 'TDATE', 'th.tdate', $this->lists['order_Dir'], $this->lists['order'] ); ?></th>
			<th width="1%"><?php echo JHTML::_('grid.sort', 'POSITION', 'tc.position', $this->lists['order_Dir'], $this->lists['order'] ); ?></th>
			<th width="1%" nowrap="nowrap"><?php echo JText::_( 'TEAM_ID' ); ?></th>
			<th width="1%"><?php echo JHTML::_('grid.sort', 'TEAMNAME', 't.tablename', $this->lists['order_Dir'], $this->lists['order'] ); ?></th>
			<th width="1%" nowrap="nowrap"><?php echo JText::_( 'MATCHES' ); ?></th>
			<th width="3%" nowrap="nowrap"><?php echo JText::_( 'POINTS' ); ?></th>
			<th width="3%" nowrap="nowrap"><?php echo JText::_( 'WINS' ); ?></th>
			<th width="3%" nowrap="nowrap"><?php echo JText::_( 'DRAWS' ); ?></th>
			<th width="5" nowrap="nowrap"><?php echo JText::_( 'DEFEATS' ); ?></th>
			<th width="3%" nowrap="nowrap"><?php echo JText::_( 'SCOREPLUS' ); ?></th>
			<th width="5" nowrap="nowrap"><?php echo JText::_( 'SCOREMINUS' ); ?></th>
			<th width="1%" nowrap="nowrap"><?php echo JText::_( 'PUBLISHED' ); ?></th>
			

		    <th width="1%" nowrap="nowrap"><?php echo JHTML::_('grid.sort', 'ID', 'id', $this->lists['order_Dir'], $this->lists['order'] ); ?></th>
		</tr>
	</thead>

	<tfoot>
		<tr>
			<td colspan="12">
				<?php //echo $this->pageNav->getListFooter(); ?>
			</td>
		</tr>
	</tfoot>

	<tbody>
		<?php
		$k = 0;
		for ($i=0, $n=count( $this->rows ); $i < $n; $i++) {
			$row = &$this->rows[$i];
			$link 		= 'index.php?option=com_lr&amp;controller=tablecontents&amp;task=edit&amp;cid[]='. $row->id;
			$checked 	= JHTML::_('grid.checkedout', $row, $i );
			$published 	= JHTML::_('grid.published', $row, $i );
   		?>
		<tr class="<?php echo "row$k"; ?>">
			<td><?php echo $this->pageNav->getRowOffset( $i ); ?></td>
			<td><?php echo $checked;?></td>
			<td align="center"><?php echo $row->leagueseasons_id; ?></td>
			

			<td align="center"><?php echo $row->name; ?></td>
			<td align="center"><?php echo $row->tname; ?></td>
			<td align="center"><?php echo $row->tdate; ?></td>
			<td align="center"><?php echo $row->position; ?></td>
			<td align="center"><?php echo $row->team_id; ?></td>
			<td align="left">
				<span class="editlinktip hasTip" 
					title="<?php echo JText::_( 'EDIT TABLECONTENTS' );?>::<?php echo $row->tablename; ?>">
				<a href="<?php echo $link; ?>">
				<?php echo htmlspecialchars($row->tablename, ENT_QUOTES, 'UTF-8'); ?>
				</a></span>
			<td align="center"><?php echo $row->matches; ?></td>
			<td align="center"><?php echo $row->points; ?></td>
			<td align="center"><?php echo $row->wins; ?></td>
			<td align="center"><?php echo $row->draws; ?></td>
			<td align="center"><?php echo $row->defeats; ?></td>
			<td align="center"><?php echo $row->scoreplus; ?></td>
			<td align="center"><?php echo $row->scoreminus; ?></td>
			<td align="center"><?php echo $published; ?></td>
			<td align="center"><?php echo $row->id; ?></td>
		</tr>
		<?php $k = 1 - $k; } ?>

	</tbody>

</table>

<p class="copyright">
	<?php //echo lrAdmin::footer( ); ?>
</p>

	<input type="hidden" name="boxchecked" value="0" />
	<input type="hidden" name="option" value="com_lr" />
	<input type="hidden" name="view" value="tablecontents" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="controller" value="tablecontents" />
	<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
	<input type="hidden" name="filter_order_Dir" value="" />
</form>
